package cn.shadow.frame.screen;

import cn.shadow.frame.game.MyGame;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.ScreenAdapter;
import com.badlogic.gdx.scenes.scene2d.Stage;


/**
 * 所有场景基类
 */
public abstract class MyScreen extends ScreenAdapter {

    protected MyGame myGame;

    public MyScreen(MyGame myGame) {
        this.myGame = myGame;
    }
    public abstract Stage getControlStage();

    /**
     * 在切换场景时会调用
     */
    @Override
    public void show() {
        Stage controlStage = getControlStage();
        addLister(controlStage);
        Gdx.input.setInputProcessor(controlStage);
    }

    @Override
    public void render(float delta) {
        super.render(delta);
    }

    protected abstract void addLister(Stage controlStage);
}
